/*
******************************************************************************************************* 
**  Copyright (C) 2019, 苏州检易生物科技有限公司 
**  All rights reserved. 
** 
**  FileName:       	schedule.h
**  Description:	
**  Author:        	 
**  Version				v0.1
**  Date:           	2019-09-02
**	Function List： 
**  History:         
*********************************************************************************************************
*/
/*
*********************************************************************************************************
*                                              	防止重复包含
*********************************************************************************************************
*/

#ifndef _SCHEDULE_PERIOD_H_
#define _SCHEDULE_PERIOD_H_
/*
*********************************************************************************************************
*                                              	调试开关
*********************************************************************************************************
*/



/*
*********************************************************************************************************
*                                              	头文件
*********************************************************************************************************
*/


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <rtthread.h>
#include "stm32h7xx_hal.h"
#include "template_list.h"
#include "system_cfg.h"
#include "tube.h"



/*
*********************************************************************************************************
*                                              	宏定义
*********************************************************************************************************
*/
#define TUBE_LOAD_REHOME_PERIOD		40
#define PMT_ROTATE_REHOME_PERIOD	120
#define REACTION_REHOME_PERIOD		45
#define CLEAN_DISK_REHOME_PERIOD	40
/*
*********************************************************************************************************
*                                              枚举和结构体类型定义
*********************************************************************************************************
*/
typedef enum{
	TEST_PROCESS_NULL 						= 0x00000000,
	TEST_PROCESS_LOAD 						= 0x00000001,
	TEST_PROCESS_R1 							= 0x00000002,
	TEST_PROCESS_R2 							= 0x00000004,
	TEST_PROCESS_SAMPLE 					= 0x00000008,
	TEST_RROCESS_SHAKE_SAMPLE			= 0x00000010,
	TEST_PROCESS_R2_DL 						= 0x00000020,
	TEST_PROCESS_MAGNET 					= 0x00000040,
	TEST_PROCESS_SHAKE_MAGNET			= 0x00000080,
	TEST_PROCESS_GO_CLEAN					= 0x00000100,
	TEST_PROCESS_SUCK_P1 					= 0x00000200,
	TEST_PROCESS_SPIT_P1 					= 0x00000400,
	TEST_PROCESS_SUCK_P2 					= 0x00000800,
	TEST_PROCESS_SPIT_P2 					= 0x00001000,
	TEST_PROCESS_SUCK_P3 					= 0x00002000,
	TEST_PROCESS_SPIT_P3 					= 0x00004000,
	TEST_PROCESS_SUCK_P4 					= 0x00008000,
	
	TEST_PROCESS_REAGENTA					= 0x00010000,
	TEST_PROCESS_SHAKE_REAGENTA		= 0x00020000,
	TEST_PROCESS_RELOAD						= 0x00040000,
	TEST_PROCESS_PMT							= 0x00080000,
	TEST_PROCESS_FLASH						= 0x00100000,
	TEST_PROCESS_WASTE						= 0x00200000,
	
	TEST_RROCESS_DILUTE						= 0x00400000,
	TEST_RROCESS_DILUTE_SHIFT			= 0x00800000,
}test_process_t;

typedef enum{
	RND_LOAD_GRID,
	RND_CLEAN_GRID,
	RND_RELOAD_GRID,
	RND_REAGENT_GRID,
	RND_MAGNET_GRID,
	RND_SUCK_DILUTE_GRID,
	RND_SAMPLE_GRID,
	RND_SHAKE_GRID,
}rnd_grid_t;


typedef struct {
	uint16_t period_cnt;
	test_process_t process_act;
}method_act_t;
/*
*********************************************************************************************************
*                                              	全局变量声明
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*                                              	函数声明
*********************************************************************************************************
*/
void* process_get_tube(uint32_t period,test_process_t process);
uint8_t rnd_get_grid(rnd_grid_t);
uint32_t get_process_period(method_t method,test_process_t process);
#endif
